﻿#region My Group
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Data;
using System.Transactions;
using Common;

namespace BusinessLogic
{
    [ServiceBehavior(TransactionAutoCompleteOnSessionClose = true, InstanceContextMode = InstanceContextMode.PerSession,
        TransactionIsolationLevel = System.Transactions.IsolationLevel.ReadCommitted)]
    public class DataObject : Interface.IDataObject
    {
        #region Dùng Chung
        public DateTime SelectDate()
        {
            return DateTime.Now;
        }
        public byte[] GetImage(string linksRoot)
        {
            try
            {
                return BusinessLogic.NhanVien.GetImage(linksRoot);
            }
            catch (Exception)
            {
                return null;
            }
        }
        public Entities.GetID SelectID(Entities.GetID id)
        {
            try
            {
                return BusinessLogic.GetID.SelectID(id);
            }
            catch (Exception)
            {
                return null;
            }
        }

        public Entities.GetCombobox[] SelectCombox(Entities.GetCombobox combox)
        {
            try
            {
                return BusinessLogic.GetCombobox.SelectCombox(combox);
            }
            catch (Exception)
            {
                return null;
            }
        }
        public Entities.HienThiHangHoaListview[] SelectChiTietHangHoaCacBang(Entities.HienThiHangHoaListview hoadon)
        {
            try
            {
                return BusinessLogic.HienThiHangHoaListview.SelectChiTietHangHoaCacBang(hoadon);
            }
            catch (Exception)
            {
                return null;
            }
        }
        #endregion

        #region Vương Văn Hùng

        #region Nhân viên
        public Entities.NhanVien[] SelectNhanVien(Entities.NhanVien nhanvien)
        {
            return BusinessLogic.NhanVien.SelectNhanVien(nhanvien);
        }
        public int InsertUpdateNhanVien(Entities.NhanVien nhanvien)
        {
            return BusinessLogic.NhanVien.InsertUpdate(nhanvien);
        }

        public int DeletedNhanVien(Entities.NhanVien nhanvien)
        {
            return BusinessLogic.NhanVien.Delete(nhanvien);
        }
        #endregion

        #region Nhà cung cấp
        public Entities.NhaCungCap[] SelectNhaCungCap(Entities.NhaCungCap cungcap)
        {
            try
            {
                return BusinessLogic.NhaCungCap.SelectNhaCungCap(cungcap);
            }
            catch (Exception)
            {
                return null;
            }
        }

        public int InsertUpdateNhaCungCap(Entities.NhaCungCap cungcap)
        {
            try
            {
                return BusinessLogic.NhaCungCap.InsertUpdate(cungcap);
            }
            catch (Exception)
            {
                return 0;
            }
        }

        public int DeleteNhaCungCap(Entities.NhaCungCap cungcap)
        {
            try
            {
                return BusinessLogic.NhaCungCap.Delete(cungcap);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        #endregion

        #region Chi tiết hàng hóa nhà cung cấp
        public Entities.ChiTietHangHoaNhaCungCap[] SelectChiTietHangHoaNhaCungCap(Entities.ChiTietHangHoaNhaCungCap chitiet)
        {
            try
            {
                return ChiTietHangHoaNhaCungCap.SelectChiTietHangHoaNhaCungCap(chitiet);
            }
            catch (Exception)
            {
                return null;
            }
        }

        public int InsertUpdate(Entities.ChiTietHangHoaNhaCungCap[] cungcap)
        {
            try
            {
                return ChiTietHangHoaNhaCungCap.InsertUpdateList(cungcap);
            }
            catch (Exception)
            {
                return 0;
            }
        }

        public int Delete(Entities.ChiTietHangHoaNhaCungCap cungcap)
        {
            try
            {
                return ChiTietHangHoaNhaCungCap.Delete(cungcap);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        #endregion

        #region Đơn đặt hàng nhà cung cấp
        public Entities.DonDatHangNCC[] SelectDonDatHangNCC(Entities.DonDatHangNCC hoadon)
        {
            try
            {
                return BusinessLogic.DonDatHangNCC.SelectDonDatHangNCC(hoadon);
            }
            catch (Exception)
            {
                return null;
            }
        }
        #endregion

        #region Hóa đơn nhập kho
        public Entities.HoaDonNhap[] SelectHoaDonNhap(Entities.HoaDonNhap hoadon)
        {
            try
            {
                return BusinessLogic.HoaDonNhap.SelectHoaDonNhap(hoadon);
            }
            catch (Exception)
            {
                return null;
            }
        }
        public int InsertUpdateHoaDonNhap(Entities.HoaDonNhap hoadon)
        {
            try
            {
                return BusinessLogic.HoaDonNhap.InsertUpdateHoaDonNhap(hoadon);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        #endregion

        #region Chi tiết hóa đơn nhập
        public Entities.ChiTietHoaDonNhap[] SelectChiTietHoaDonNhap(Entities.ChiTietHoaDonNhap hoadon)
        {
            try
            {
                return BusinessLogic.ChiTietHoaDonNhap.SelectChiTietHoaDonNhap(hoadon);
            }
            catch (Exception)
            {
                return null;
            }
        }
        public int InsertUpdateListChiTietHoaDonNhap(Entities.ChiTietHoaDonNhap[] chitiet)
        {
            try
            {
                return BusinessLogic.ChiTietHoaDonNhap.InsertUpdateListChiTietHoaDonNhap(chitiet);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        public int InsertUpdateChiTietHoaDonNhap(Entities.ChiTietHoaDonNhap chitiet)
        {
            try
            {
                return BusinessLogic.ChiTietHoaDonNhap.InsertUpdateChiTietHoaDonNhap(chitiet);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        #endregion

        #region Khách hàng trả lại bán buôn
        public Entities.KhachHangTraLaiBanBuon[] SelectKhachHangTraLaiBanBuon(Entities.KhachHangTraLaiBanBuon hoadon)
        {
            try
            {
                return BusinessLogic.KhachHangTraLaiBanBuon.SelectKhachHangTraLaiBanBuon(hoadon);
            }
            catch (Exception)
            {
                return null;
            }
        }
        public int InsertUpdateKhachHangTraLaiBanBuon(Entities.KhachHangTraLaiBanBuon hoadon)
        {
            try
            {
                return BusinessLogic.KhachHangTraLaiBanBuon.InsertUpdateKhachHangTraLaiBanBuon(hoadon);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        #endregion

        #region Chi tiết khách hàng trả lại bán buôn
        public Entities.ChiTietKhachHangTraLaiBanBuon[] SelectChiTietKhachHangTraLaiBanBuon(Entities.ChiTietKhachHangTraLaiBanBuon hoadon)
        {
            try
            {
                return BusinessLogic.ChiTietKhachHangTraLaiBanBuon.SelectChiTietKhachHangTraLaiBanBuon(hoadon);
            }
            catch (Exception)
            {
                return null;
            }
        }
        //public int InsertUpdateChiTietKhachHangTraLaiBanBuon(Entities.ChiTietKhachHangTraLaiBanBuon hoadon)
        //{
        //    try
        //    {
        //        return BusinessLogic.ChiTietKhachHangTraLaiBanBuon.InsertUpdateChiTietKhachHangTraLaiBanBuon(hoadon);
        //    }
        //    catch (Exception)
        //    {
        //        return 0;
        //    }
        //}
        #endregion

        #region Khách hàng trả lại bán lẻ
        public Entities.KhachHangTraLaiBanLe[] SelectKhachHangTraLaiBanLe(Entities.KhachHangTraLaiBanLe hoadon)
        {
            try
            {
                return BusinessLogic.KhachHangTraLaiBanLe.SelectKhachHangTraLaiBanLe(hoadon);
            }
            catch (Exception)
            {
                return null;
            }
        }
        public int InsertUpdateKhachHangTraLaiBanLe(Entities.KhachHangTraLaiBanLe hoadon)
        {
            try
            {
                return BusinessLogic.KhachHangTraLaiBanLe.InsertUpdateKhachHangTraLaiBanLe(hoadon);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        #endregion

        #region Chi tiết khách hàng trả lại bán lẻ
        public Entities.ChiTietKhachHangTraLaiBanLe[] SelectChiTietKhachHangTraLaiBanLe(Entities.ChiTietKhachHangTraLaiBanLe hoadon)
        {
            try
            {
                return BusinessLogic.ChiTietKhachHangTraLaiBanLe.SelectChiTietKhachHangTraLaiBanLe(hoadon);
            }
            catch (Exception)
            {
                return null;
            }
        }
        public int InsertUpdateChiTietKhachHangTraLaiBanLe(Entities.ChiTietKhachHangTraLaiBanLe hoadon)
        {
            try
            {
                return BusinessLogic.ChiTietKhachHangTraLaiBanLe.InsertUpdateChiTietKhachHangTraLaiBanLe(hoadon);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        #endregion

        #region Cập nhật
        public int Update_DuNo(string HanhDong, string MaUpdate, string DuNo)
        {
            try
            {
                return BusinessLogic.Update.Update_DuNo(HanhDong, MaUpdate, DuNo);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        public int Update_SoLuongConLai(string HanhDong, string MaHoaDon, string MaHangHoa, string SoLuongConLai)
        {
            try
            {
                return BusinessLogic.Update.Update_SoLuongConLai(HanhDong, MaHoaDon, MaHangHoa, SoLuongConLai);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        public int Update_TrangThaiDonDatHang(string HanhDong, string MaDonDatHang, string TrangThai)
        {
            try
            {
                return BusinessLogic.Update.Update_TrangThaiDonDatHang(HanhDong, MaDonDatHang, TrangThai);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        #endregion

        #region Trừ kho cộng kho
        public int CongKhoHang(string MaKho, string MaHangHoa, string SoLuong)
        {
            try
            {
                return BusinessLogic.Cong_Tru_KhoHang.CongKhoHang(MaKho, MaHangHoa, SoLuong);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        public int TruKhoHang(string MaKho, string MaHangHoa, string SoLuong)
        {
            try
            {
                return BusinessLogic.Cong_Tru_KhoHang.TruKhoHang(MaKho, MaHangHoa, SoLuong);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        #endregion

        #endregion

        #region Nguyễn Thu Hương
        #region báo cáo xuất hủy hàng hóa
        public Entities.BCXuatHuyHangHoa BCXuatHuyHangHoa()
        {
            return BusinessLogic.BCXuatHuyHangHoa.Select();
        }
        #endregion
        #region báo cáo công nợ ncc
        public Entities.SelectTongHopCongNo SelectTongHopCongNoNCC(string hanhdong)
        {
            return BusinessLogic.SelectTongHopCongNo.Select(hanhdong);
        }
        #endregion
        #region Nhóm Hàng Hóa
        public Entities.HangHoa[] SelectHangHoaTheoNhomHangHoa(Entities.HangHoa donvitinh)
        {
            return BusinessLogic.HangHoaTheoMaNhomHangHoa.SelectHangHoaTheoNhomHang(donvitinh);
        }
        public Entities.NhomHangHoa[] SelectNhomHangHoa(Entities.NhomHangHoa donvitinh)
        {
            return BusinessLogic.NhomHangHoa.Select(donvitinh);
        }

        public int InsertUpdateNhomHangHoa(Entities.NhomHangHoa donvitinh)
        {
            return BusinessLogic.NhomHangHoa.InsertUpdate(donvitinh);
        }

        public int DeletedNhomHangHoa(Entities.NhomHangHoa donvitinh)
        {
            return BusinessLogic.NhomHangHoa.Delete(donvitinh);
        }
        #endregion

        #region đơn vị tính
        public Entities.DVT[] SelectDVT(Entities.DVT donvitinh)
        {
            return BusinessLogic.DVT.Select(donvitinh);
        }

        public int InsertUpdateDVT(Entities.DVT donvitinh)
        {
            return BusinessLogic.DVT.InsertUpdate(donvitinh);
        }

        public int DeletedDVT(Entities.DVT donvitinh)
        {
            return BusinessLogic.DVT.Delete(donvitinh);
        }
        #endregion

        #region khách hàng
        public Entities.KhachHang[] SelectKH(Entities.KhachHang khachhang)
        {
            return BusinessLogic.KhachHang.Select(khachhang);
        }

        public int InsertUpdateKH(Entities.KhachHang khachhang)
        {
            return BusinessLogic.KhachHang.InsertUpdate(khachhang);
        }

        public int DeletedKH(Entities.KhachHang khachhang)
        {
            return BusinessLogic.KhachHang.Delete(khachhang);
        }

        public Entities.KhachHang[] SelectKhachHang(Entities.KhachHang donvitinh)
        {
            return BusinessLogic.KhachHang.Select(donvitinh);
        }

        #endregion

        #region tiền tệ
        public Entities.TienTe[] SelectTienTe(Entities.TienTe TienTe)
        {
            return BusinessLogic.TienTe.Select(TienTe); ;
        }

        public int InsertUpdateTienTe(Entities.TienTe TienTe)
        {
            return BusinessLogic.TienTe.InsertUpdate(TienTe); ;
        }

        public int DeletedTienTe(Entities.TienTe TienTe)
        {
            return BusinessLogic.TienTe.Delete(TienTe); ;
        }
        #endregion

        #region thuế
        public Entities.Thue[] SelectThue(Entities.Thue Thue)
        {
            return BusinessLogic.Thue.Select(Thue); ;
        }

        public int InsertUpdateThue(Entities.Thue Thue)
        {
            return BusinessLogic.Thue.InsertUpdate(Thue); ;
        }

        public int DeletedThue(Entities.Thue Thue)
        {
            return BusinessLogic.Thue.Delete(Thue); ;
        }
        #endregion

        #region loại hàng
        public Entities.LoaiHang[] SelectLoaiHang(Entities.LoaiHang LoaiHang)
        {
            return BusinessLogic.LoaiHang.SelectLoaiHang(LoaiHang); ;
        }

        public int InsertUpdateLoaiHang(Entities.LoaiHang LoaiHang)
        {
            return BusinessLogic.LoaiHang.InsertUpdate(LoaiHang); ;
        }

        public int DeletedLoaiHang(Entities.LoaiHang LoaiHang)
        {
            return BusinessLogic.LoaiHang.Delete(LoaiHang); ;
        }
        #endregion

        #region công ty
        public Entities.CongTy[] SelectCongTy(Entities.CongTy CongTy)
        {
            return BusinessLogic.CongTy.Select(CongTy); ;
        }

        public int InsertUpdateCongTy(Entities.CongTy CongTy)
        {
            return BusinessLogic.CongTy.InsertUpdate(CongTy); ;
        }
        #endregion

        #region phòng ban
        public Entities.PhongBan[] SelectPhongBan(Entities.PhongBan PhongBan)
        {
            return BusinessLogic.PhongBan.Select(PhongBan); ;
        }

        public int InsertUpdatePhongBan(Entities.PhongBan PhongBan)
        {
            return BusinessLogic.PhongBan.InsertUpdate(PhongBan); ;
        }

        public int DeletedPhongBan(Entities.PhongBan PhongBan)
        {
            return BusinessLogic.PhongBan.Delete(PhongBan); ;
        }
        #endregion

        #region gói hàng
        public Entities.GoiHang[] SelectGoiHangTheoMa(Entities.GoiHang GoiHang)
        {
            return BusinessLogic.GoiHang.SelectTheoMa(GoiHang); ;
        }

        public Entities.GoiHang[] SelectGoiHang(Entities.GoiHang GoiHang)
        {
            return BusinessLogic.GoiHang.Select(GoiHang); ;
        }

        public int InsertUpdateGoiHang(Entities.GoiHang GoiHang)
        {
            return BusinessLogic.GoiHang.InsertUpdate(GoiHang); ;
        }

        public int DeletedGoiHang(Entities.GoiHang GoiHang)
        {
            return BusinessLogic.GoiHang.Delete(GoiHang); ;
        }
        #endregion

        #region chi tiết  gói hàng
        public Entities.ChiTietGoiHang[] SelectChiTietGoiHang(Entities.ChiTietGoiHang GoiHang)
        {
            return BusinessLogic.ChiTietGoiHang.Select(GoiHang);
        }

        public int InsertUpdateChiTietGoiHang(Entities.ChiTietGoiHang[] GoiHang)
        {
            return BusinessLogic.ChiTietGoiHang.InsertUpdate(GoiHang);
        }

        public int DeletedChiTietGoiHang(Entities.ChiTietGoiHang GoiHang)
        {
            return BusinessLogic.ChiTietGoiHang.Delete(GoiHang);
        }
        #endregion

        #region phiếu xuất hủy
        public Entities.PhieuXuatHuy[] SelectPhieuXuatHuy(Entities.PhieuXuatHuy GoiHang)
        {
            return BusinessLogic.PhieuXuatHuy.Select(GoiHang);
        }
        public Entities.PhieuXuatHuy[] SelectPhieuXuatHuy1(Entities.PhieuXuatHuy GoiHang)
        {
            return BusinessLogic.PhieuXuatHuy.Select1(GoiHang);
        }
        public int InsertUpdatePhieuXuatHuy(Entities.PhieuXuatHuy GoiHang)
        {
            return BusinessLogic.PhieuXuatHuy.InsertUpdate(GoiHang); ;
        }

        public int DeletedPhieuXuatHuy(Entities.PhieuXuatHuy GoiHang)
        {
            return BusinessLogic.PhieuXuatHuy.Delete(GoiHang); ;
        }
        public void TruKhoPhieuXuatHuy(Entities.ChiTietKhoHang[] DanhSach)
        {
            BusinessLogic.PhieuXuatHuy.TruKho(DanhSach);
        }
        #endregion

        #region chi tiết  phiếu xuất hủy
        public Entities.ChiTietXuatHuy[] SelectChiTietXuatHuy(Entities.ChiTietXuatHuy GoiHang)
        {
            return BusinessLogic.ChiTietXuatHuy.Select(GoiHang); ;
        }
        public Entities.ChiTietXuatHuy[] SelectChiTietXuatHuy1(Entities.ChiTietXuatHuy GoiHang)
        {
            return BusinessLogic.ChiTietXuatHuy.Select1(GoiHang); ;
        }
        public int InsertUpdateChiTietXuatHuy(Entities.ChiTietXuatHuy[] GoiHang)
        {
            return BusinessLogic.ChiTietXuatHuy.InsertUpdate(GoiHang); ;
        }

        public int DeletedChiTietXuatHuy(Entities.ChiTietXuatHuy GoiHang)
        {
            return BusinessLogic.ChiTietXuatHuy.Delete(GoiHang); ;
        }
        #endregion

        #region kiểm kê kho
        public Entities.KiemKeKho[] SelectKiemKeKho(Entities.KiemKeKho GoiHang)
        {
            return BusinessLogic.KiemKeKho.Select(GoiHang);
        }

        public int InsertUpdateKiemKeKho(Entities.KiemKeKho GoiHang)
        {
            return BusinessLogic.KiemKeKho.InsertUpdate(GoiHang); ;
        }
        #endregion

        #region chi tiết kiểm kê kho
        public Entities.ChiTietKiemKeKho[] SelectChiTietKiemKeKho(Entities.ChiTietKiemKeKho GoiHang)
        {
            return BusinessLogic.ChiTietKiemKeKho.Select(GoiHang); ;
        }

        public int InsertUpdateChiTietKiemKeKho(Entities.ChiTietKiemKeKho[] GoiHang)
        {
            return BusinessLogic.ChiTietKiemKeKho.InsertUpdate(GoiHang); ;
        }
        public int DeleteChiTietKiemKeKho(Entities.ChiTietKiemKeKho GoiHang)
        {
            return BusinessLogic.ChiTietKiemKeKho.Delete(GoiHang); ;
        }
        #endregion

        #region chi tiết giao dịch khách hàng
        public Entities.SelectChiTietGiaoDichKhachHang SelectChitietgiaodichkhachhang(Entities.KhachHang khachhang, string makho)
        {
            return BusinessLogic.SelectChiTietGiaoDichKhachHang.Select(khachhang, makho);
        }
        #endregion

        #region mã vạch
        public Entities.ThongTinMaVach[] ThongTinMaVachHangHoa(Entities.ThongTinMaVach MaVach)
        {
            return BusinessLogic.ThongTinMaVach.sp_LayBang_ThongTinMaVachHangHoa(MaVach);
        }

         public Entities.HienThi_ChiTiet_DonDatHang HienThi_ChiTiet_DonDatHang(Entities.HienThi_ChiTiet_DonDatHang MaVach)
        {
            return BusinessLogic.HienThi_ChiTiet_DonDatHang.sp_LayHangHoaTheoMaHangHoa(MaVach);
        }
        #endregion

        #endregion

        #region Nguyễn Thế Hưởng
        #region Phân Quyền
        public Entities.LuuVietHeThong[] SelectLuuViet()
        {
            return new BusinessLogic.LuuVietHeThong().SelectLuuViet();
        }
        public void DeleteLuuViet()
        {
            new BusinessLogic.LuuVietHeThong().Xoa();
        }
        public Entities.SaoLuuHeThong[] SelectSaoLuu()
        {
            return new BusinessLogic.SaoLuuHeThong().LayBackUp();
        }
        public bool BackUp()
        {

            return new BusinessLogic.SaoLuuHeThong().BackUp();
        }
        public bool Restore(Entities.SaoLuuHeThong sl)
        {
            return new BusinessLogic.SaoLuuHeThong().Restore(sl);
        }

        public DataTable SelectChiTietQuyen(string tennhomquyen)
        {
            return new BusinessLogic.ChiTietQuyen().SelectByKey(tennhomquyen);
        }

        public int InsertChiTietQuyen(Entities.ChiTietQuyen ctq)
        {
            return new BusinessLogic.ChiTietQuyen().Insert(ctq);
        }

        public bool UpdateChiTietQuyen(Entities.ChiTietQuyen[] actq, Entities.TaiKhoan TK)
        {
            return new BusinessLogic.ChiTietQuyen().Update(actq, TK);
        }

        public int InsertNhomQuyen(Entities.NhomQuyen nq)
        {
            return new BusinessLogic.NhomQuyen().Insert(nq);
        }

        public int DeleteNhomQuyen(Entities.NhomQuyen nq)
        {
            return new BusinessLogic.NhomQuyen().Delete(nq);
        }

        public DataTable SelectNhomQuyen()
        {
            return new BusinessLogic.NhomQuyen().Select();
        }

        public DataTable SelectQuyen()
        {
            return new BusinessLogic.Quyen().Select();
        }

        public Entities.TaiKhoan DangNhap(string taikhoan, string matkhau)
        {
            return new BusinessLogic.TaiKhoan().DangNhap(taikhoan, matkhau);
        }

        public int InsertTaiKhoan(Entities.TaiKhoan tk)
        {
            return new BusinessLogic.TaiKhoan().Insert(tk);
        }

        public int UpdateTaiKhoan(Entities.TaiKhoan tk)
        {
            return new BusinessLogic.TaiKhoan().Update(tk);
        }

        public int DeleteTaiKhoan(Entities.TaiKhoan tk)
        {
            return new BusinessLogic.TaiKhoan().Delete(tk);
        }

        public DataTable SelectTaiKhoan()
        {
            return new BusinessLogic.TaiKhoan().SelectAll();
        }

        public Entities.TaiKhoan SelectTaiKhoanTheoTen(string tendangnhap)
        {
            return new BusinessLogic.TaiKhoan().SelectByKey(tendangnhap);
        }
        #endregion

        #region Đơn Đặt Hàng
        public Entities.ChiTietDonHangKH[] SelectChiTietDonHangKH(string madhhkh)
        {
            return new BusinessLogic.ChiTietDonHangKH().SelectChiTietDonHangKH(madhhkh);
        }

        public bool InsertChiTietDonHangKH(Entities.ChiTietDonHangKH[] ctddhkh, Entities.DonDatHangKH ddhkh)
        {
            return new BusinessLogic.ChiTietDonHangKH().InsertChiTietDonHangKH(ctddhkh, ddhkh);
        }

        public Entities.ChiTietDonHangNCC[] SelectChiTietDonHangNCC(string madhhncc)
        {
            return new BusinessLogic.ChiTietDonHangNCC().SelectChiTietDonHangNCC(madhhncc);
        }

        public bool InsertChiTietDonHangNCC(Entities.ChiTietDonHangNCC[] ctddhncc, Entities.DonDatHangNCC ddhncc)
        {
            return new BusinessLogic.ChiTietDonHangNCC().InsertChiTietDonHangNCC(ctddhncc, ddhncc);
        }

        public Entities.DonDatHangKH[] SelectDonDatHangKH()
        {
            return new BusinessLogic.DonDatHangKH().SelectDonDatHangKH();
        }

        public int InsertDonDatHangKH(Entities.DonDatHangKH ddhkh)
        {
            return new BusinessLogic.DonDatHangKH().InsertDonDatHangKH(ddhkh);
        }

        public int DeleteDonDatHangKH(Entities.DonDatHangKH ddhkh)
        {
            return new BusinessLogic.DonDatHangKH().DeleteDonDatHangKH(ddhkh);
        }

        public Entities.DonDatHangNCC[] SelectDonDatHangNhaCungCap()
        {
            return new BusinessLogic.DonDatHangNCC().SelectDonDatHangNCC();
        }

        public int InsertDonDatHangNCC(Entities.DonDatHangNCC ddhncc)
        {
            return new BusinessLogic.DonDatHangNCC().InsertDonDatHangNCC(ddhncc);
        }

        public int DeleteDonDatHangNCC(Entities.DonDatHangNCC ddhncc)
        {
            return new BusinessLogic.DonDatHangNCC().DeleteDonDatHangNCC(ddhncc);
        }
        #endregion
        #endregion

        #region Đào Mạnh Hòa

        #region CheckRefer - SelectAll

        public Entities.KhachHang Select_KhachHang(Entities.KhachHang kh)
        {
            return BusinessLogic.KhachHang.SelectTheoMa(kh);
        }
        // loivt
        public Entities.NhaCungCap Select_MaNCC(Entities.NhaCungCap ncc)
        {
            return BusinessLogic.NhaCungCap.SelectMaNCC(ncc);
        }

        public Entities.CongTy Select_CongTy(Entities.CongTy CongTy)
        {
            return BusinessLogic.CongTy.Select1(CongTy); ;
        }

        public bool CheckRefer(Entities.CheckRefer cr)
        {
            return BusinessLogic.CheckRefer.CheckReferen(cr);
        }

        public Entities.SelectAll SelectAll(Entities.SelectAll temp)
        {
            switch (temp.HanhDong)
            {
                case "CongNo":
                    {
                        return BusinessLogic.SelectAll.CongNo(temp.MaKho);
                    }
                case "BanBuon":
                    {
                        return BusinessLogic.SelectAll.BanBuon(temp.MaKho);
                    }
                default:
                    return null;
            }
        }
        #endregion

        #region Chi tiết kho hàng
        public Entities.ChiTietKhoHang[] Select_ChiTietKho(Entities.ChiTietKhoHang chitiet)
        {
            return BusinessLogic.SelectAll.SelectChiTietHangHoaTheoKho(chitiet);
        }

        public Entities.ChiTietKhoHang[] SelectHangHoa_TrongKho()
        {
            return BusinessLogic.SelectAll.Select();
        }

        public Entities.HangHoa[] Select_HangHoa(Entities.ChiTietKhoHang chitiet)
        {
            return BusinessLogic.SelectAll.SelectHangHoaTheoKho(chitiet);
        }
        #endregion

        #region Thẻ Víp
        // select
        public Entities.TheVip[] SelectTheVip(string ten)
        {
            return BusinessLogic.TheVip.Select(ten);
        }
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int InsertUpdateTheVip(Entities.TheVip thevip)
        {
            return BusinessLogic.TheVip.InsertUpdate(thevip);
        }
        #endregion

        #region Loại Thẻ Víp
        // select
        public Entities.LoaiTheVip[] SelectLoaiTheVip(string hanhdong)
        {
            return BusinessLogic.LoaiTheVip.Select(hanhdong);
        }
        // insert update
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int InsertUpdateLoaiTheVip(Entities.LoaiTheVip loaithevip)
        {
            return BusinessLogic.LoaiTheVip.InsertUpdate(loaithevip);
        }
        // xóa
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int DeleteLoaiTheVip(Entities.LoaiTheVip loaithevip)
        {
            return BusinessLogic.LoaiTheVip.Delete(loaithevip);
        }
        #endregion

        #region Tỷ Lệ Tính
        // select
        public Entities.TyLeTinh[] SelectTyLeTinh()
        {
            return BusinessLogic.TyLeTinh.Select();
        }
        // insert update
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int InsertUpdateTyLeTinh(Entities.TyLeTinh tyletinh)
        {
            return BusinessLogic.TyLeTinh.InsertUpdate(tyletinh);
        }
        #endregion

        #region Điểm Thưởng Khách Hàng
        // select
        public Entities.DiemThuongKhachHang[] SelectTinhDiemThuong()
        {
            return BusinessLogic.DiemThuongKhachHang.Select();
        }
        // insert update
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int InsertUpdateTinhDiemThuong(Entities.DiemThuongKhachHang diemthuongkhachhang)
        {
            return BusinessLogic.DiemThuongKhachHang.InsertUpdate(diemthuongkhachhang);
        }
        #endregion

        #region Hóa Đơn Bán Buôn
        public Entities.GetID LayIDHDBB(Entities.GetID gitri)
        {
            return BusinessLogic.GetID.sp_getIDHDBB(gitri);
        }
        // select
        public Entities.HDBanBuon[] SelectHDBanBuon()
        {
            return BusinessLogic.HDBanBuon.Select();
        }
        public Entities.HDBanBuon[] SelectHDBanBuonID(Entities.HDBanBuon hd)
        {
            return BusinessLogic.HDBanBuon.Select(hd);
        }
        // select theo mã khách hàng (loivt)
        public Entities.HDBanBuon[] SelectHDBanBuonTheoMaKH(string makh)
        {
            return BusinessLogic.HDBanBuon.SelectTheoMaKH(makh);
        }
        // select theo maHDBanBuon (loivt)
        public Entities.HDBanBuon[] SelectHDBanBuonTheoMaHDBanBuon(string mahdbb)
        {
            return BusinessLogic.HDBanBuon.SelectTheoMaHDBanBuon(mahdbb);
        }

        // insert update
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int InsertUpdateHDBanBuon(Entities.HDBanBuon hdbanbuon)
        {
            return BusinessLogic.HDBanBuon.InsertUpdate(hdbanbuon);
        }
        #endregion

        #region Chi tiết Hóa Đơn Bán Buôn
        // select
        public Entities.ChiTietHDBanBuon[] SelectChiTietHDBanBuon()
        {
            return BusinessLogic.ChiTietHDBanBuon.Select();
        }
        #endregion

        #region Hóa Đơn Bán Lẻ
        public Entities.GetID sp_getID_BanLe(Entities.GetID get)
        {
            return BusinessLogic.GetID.sp_getID_BanLe(get);
        }
        // select
        public Entities.HDBanLe[] SelectHDBanLe()
        {
            return BusinessLogic.HDBanLe.Select();
        }
        // insert update
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int InsertUpdateHDBanLe(Entities.HDBanLe hdbanle)
        {
            return BusinessLogic.HDBanLe.InsertUpdate(hdbanle);
        }
        #endregion

        #region Chi tiết Hóa Đơn Bán Lẻ
        // select
        public Entities.ChiTietHDBanle[] SelectChiTietHDBanLe()
        {
            return BusinessLogic.ChiTietHDBanLe.Select();
        }
        #endregion

        #region Khuyến mại tặng hàng
        // select
        public Entities.KhuyenMaiTangHang[] SelectKhuyenMaiTangHang()
        {
            return BusinessLogic.KhuyenMaiTangHang.Select();
        }
        // insert update
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int InsertUpdateKhuyenMaiTangHang(Entities.KhuyenMaiTangHang khuyenmaitanghang)
        {
            return BusinessLogic.KhuyenMaiTangHang.InsertUpdate(khuyenmaitanghang);
        }
        // delete
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int DeleteKhuyenMaiTangHang(Entities.KhuyenMaiTangHang khuyenmaitanghang)
        {
            return BusinessLogic.KhuyenMaiTangHang.Delete(khuyenmaitanghang);
        }
        #endregion

        #region Chi tiết Khuyến mại tặng hàng
        // select
        public Entities.ChiTietKhuyenMaiTangHang[] SelectChiTietKhuyenMaiTangHang()
        {
            return BusinessLogic.ChiTietKhuyenMaiTangHang.Select();
        }
        #endregion

        #region Số Dư Sổ Quỹ
        // select
        public Entities.SelectSoQuy SelectSSoQuy(string makho)
        {
            return BusinessLogic.SelectSoQuy.Select(makho);
        }
        public Entities.SoDuSoQuy[] SelectSoQuy(string makho)
        {
            return BusinessLogic.SoQuy.Select(makho);
        }
        // insert
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int InsertSoQuy(Entities.SoDuSoQuy sodusoquy)
        {
            return BusinessLogic.SoQuy.Insert(sodusoquy);
        }
        // update
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int UpdateSoQuy(Entities.SoDuSoQuy sodusoquy)
        {
            return BusinessLogic.SoQuy.Update(sodusoquy);
        }
        // update trang thai
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int UpdateTrangThaiSoQuy(Entities.SoDuSoQuy sodusoquy)
        {
            return BusinessLogic.SoQuy.UpdateTrangThai(sodusoquy);
        }
        // xóa
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int DeleteSoQuy(Entities.SoDuSoQuy sodusoquy)
        {
            return BusinessLogic.SoQuy.Delete(sodusoquy);
        }
        #endregion

        #region Số Dư Công Nợ
        // select
        public Entities.SoDuCongNo[] SelectCongNoTheoKho(string makho)
        {
            return BusinessLogic.CongNo.Select(makho);
        }
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int InsertUpdateCongNo(Entities.SoDuCongNo[] nv)
        {
            return BusinessLogic.CongNo.InsertUpdate(nv);
        }
        // update
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public bool UpdateCongNoMang(Entities.SoDuCongNo[] soducongno)
        {
            return BusinessLogic.CongNo.Update(soducongno);
        }
        // xóa
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int DeleteCongNo(Entities.SoDuCongNo soducongno)
        {
            return BusinessLogic.CongNo.Delete(soducongno);
        }
        #endregion

        #region Trả Lại Nhà Cung Cấp
        public Entities.ChiTietHoaDonNhap[] Select_ChiTietHoaDonNhap(Entities.ChiTietHoaDonNhap temp)
        {
            return BusinessLogic.ChiTietHoaDonNhap.SelectChiTietHoaDonNhap(temp);
        }
        public Entities.HoaDonNhap[] Select_HoaDonNhap(Entities.HoaDonNhap temp)
        {
            return BusinessLogic.HoaDonNhap.SelectHoaDonNhap(temp);
        }
        // get id
        public Entities.GetID GetIDTraLaiNCC(Entities.GetID id)
        {
            return BusinessLogic.GetID.sp_getIDTraLaiNCC(id);
        }
        // select
        public Entities.TraLaiNCC[] SelectTraLaiNCC()
        {
            return BusinessLogic.TraLaiNCC.Select();
        }
        // insert update
        [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
        public int InsertUpdateTraLaiNCC(Entities.TraLaiNCC hdbanle)
        {
            return BusinessLogic.TraLaiNCC.InsertUpdate(hdbanle);
        }
        // select
        public Entities.ChiTietTraLaiNCC[] SelectChiTietTraLaiNCC()
        {
            return BusinessLogic.ChiTietTraLaiNCC.Select();
        }
        #endregion

        #endregion

        #region Nguyễn Trường Sơn
        #region Hàng Hóa
        public Entities.HangHoa[] SelectHangHoa()
        {
            return BusinessLogic.HangHoa.SelectHangHoa();
        }
        public Entities.HangHoa[] SelectHangHoaS(Entities.HangHoa hanghoa)
        {
            return BusinessLogic.HangHoa.SelectHangHoa(hanghoa);
        }
        public Entities.HangHoa[] Select_HangHoaAll(Entities.HangHoa hanghoa)
        {
            try
            {
                return BusinessLogic.HangHoa.SelectHangHoa1(hanghoa);
            }
            catch (Exception)
            {
                return null;
            }
        }
        public int InsertHangHoa(Entities.HangHoa HangHoa)
        {
            return BusinessLogic.HangHoa.Insert(HangHoa);
        }
        public int UpdateHangHoa(Entities.HangHoa HangHoa)
        {
            return BusinessLogic.HangHoa.Update(HangHoa);
        }

        public int DeletedHangHoa(Entities.HangHoa HangHoa)
        {
            return BusinessLogic.HangHoa.Delete(HangHoa);
        }
        #endregion

        #region Kho hàng
        public Entities.KhoHang[] SelectAllKhoHang()
        {
            try
            {
                return BusinessLogic.KhoHang.SelectAllKhoHang();
            }
            catch (Exception)
            {
                return null;
            }
        }
        public Entities.KhoHang[] SelectKhoHang(Entities.KhoHang khohang)
        {
            try
            {
                return BusinessLogic.KhoHang.SelectKhoHang(khohang);
            }
            catch (Exception)
            {
                return null;
            }
        }
        public Entities.ChiTietKhoHang[] SelectChiTietKhoHang(Entities.ChiTietKhoHang hoadon)
        {
            try
            {
                return BusinessLogic.ChiTietKhoHang.SelectChiTietKhoHang(hoadon);
            }
            catch (Exception)
            {
                return null;
            }
        }
        public int DeleteChiTietKhoHang(Entities.ChiTietKhoHang KhoHang)
        {
            return BusinessLogic.ChiTietKhoHang.Delete(KhoHang);
        }
        public int InsertKhoHang(Entities.KhoHang KhoHang)
        {
            return BusinessLogic.KhoHang.Insert(KhoHang);
        }
        public int UpdateKhoHang(Entities.KhoHang KhoHang)
        {
            return BusinessLogic.KhoHang.Update(KhoHang);
        }

        public int DeletedKhoHang(Entities.KhoHang KhoHang)
        {
            return BusinessLogic.KhoHang.Delete(KhoHang);
        }

        #endregion

        #endregion

        #region Vương Trí Lợi

        #region Chính Sách Giá Hàng Hóa
        public Entities.ChinhSachGiaHangHoa[] SelectChinhSachGiaHangHoa()
        {
            return BusinessLogic.ChinhSachGiaHangHoa.Select();
        }

        public bool InsertUpdateChinhSachGiaHangHoa(Entities.ChinhSachGiaHangHoa chinhsachgiahanghoa)
        {
            return BusinessLogic.ChinhSachGiaHangHoa.InsertUpdate(chinhsachgiahanghoa);
        }

        public bool DeleteChinhSachGiaHangHoa(Entities.ChinhSachGiaHangHoa chinhsachgiahanghoa)
        {
            return BusinessLogic.ChinhSachGiaHangHoa.Delete(chinhsachgiahanghoa);
        }

        public Entities.ChinhSachGiaHangHoa SelectHangHoaCSGHH(Entities.GoiHang gh)
        {
            return BusinessLogic.ChinhSachGiaHangHoa.SelectCSGHH(gh);
        }

        #region Chi Tiet Chinh Sach Gia Hang Hoa
        // select
        public Entities.ChiTietChinhSachGiaHangHoa[] SelectChiTietChinhSachGiaHangHoa()
        {
            return BusinessLogic.ChiTietChinhSachGiaHangHoa.Select();
        }
        // insert update
        public bool InsertUpdateChiTietChinhSachGiaHangHoa(Entities.ChiTietChinhSachGiaHangHoa[] chitietchinhsachgiahanghoa)
        {
            return BusinessLogic.ChiTietChinhSachGiaHangHoa.InsertUpdate(chitietchinhsachgiahanghoa);
        }
        // xóa
        public bool DeleteChiTietChinhSachGiaHangHoa(Entities.ChiTietChinhSachGiaHangHoa chitietchinhsachgiahanghoa)
        {
            return BusinessLogic.ChiTietChinhSachGiaHangHoa.Delete(chitietchinhsachgiahanghoa);
        }
        #endregion

        #endregion

        #region Khoản Mục Thu Chi
        public Entities.KMThuChi[] SelectKMThuChi(Entities.KMThuChi giatri)
        {
            return BusinessLogic.KMThuChi.Select(giatri);
        }

        public int InsertUpdateKMThuChi(Entities.KMThuChi giatri)
        {
            return BusinessLogic.KMThuChi.sp_InsertUpdate(giatri);
        }

        public int DeleteKMThuChi(Entities.KMThuChi giatri)
        {
            return BusinessLogic.KMThuChi.Delete(giatri);
        }

        #endregion

        #region Nhóm TK Kế Toán
        public Entities.NhomTKKeToan[] SelectNhomTKKeToan(Entities.NhomTKKeToan giatri)
        {
            return BusinessLogic.NhomTKKeToan.Select(giatri);
        }

        public int InsertUpdateNhomTKKeToan(Entities.NhomTKKeToan giatri)
        {
            return BusinessLogic.NhomTKKeToan.InsertUpdate(giatri);
        }

        public int DeleteNhomTKKeToan(Entities.NhomTKKeToan giatri)
        {
            return BusinessLogic.NhomTKKeToan.Delete(giatri);
        }
        #endregion

        #region Phiếu Chi
        public Entities.PhieuChi[] SelectPhieuChi()
        {
            return BusinessLogic.PhieuChi.Select();
        }
        // select theo dia diem
        public Entities.PhieuChi[] SelectPhieuChiTheoDiaDiem(string madiadiem)
        {
            return BusinessLogic.PhieuChi.SelectTheoDiaDiem(madiadiem);
        }

        public bool InsertUpdatePhieuChi(Entities.PhieuChi phieuchi)
        {
            return BusinessLogic.PhieuChi.InsertUpdate(phieuchi);
        }

        public bool DeletePhieuChi(Entities.PhieuChi phieuchi)
        {
            return BusinessLogic.PhieuChi.Delete(phieuchi);
        }

        public bool UpdateDuNoKhachHang(Entities.KhachHang khachhang)
        {
            return BusinessLogic.PhieuChi.UpdateDuNo(khachhang);
        }

        public Entities.KhachHang[] SelectDuNoKhachHang(string makh)
        {
            return BusinessLogic.PhieuChi.Selectkh(makh);
        }

        public bool UpdateDuNoNhaCungCap(Entities.NhaCungCap nhacungcap)
        {
            return BusinessLogic.PhieuChi.UpdateDuNo(nhacungcap);
        }

        public Entities.NhaCungCap[] SelectDuNoNCC(string ncc)
        {
            return BusinessLogic.PhieuChi.Selectncc(ncc);
        }

        // select
        public Entities.KMThuChi[] SelectKMThuChiString(string LoaiKM)
        {
            return BusinessLogic.PhieuChi.SelectKMChi(LoaiKM);
        }

        #endregion

        #region Phiếu Thu
        public Entities.PhieuThu[] SelectPhieuThu()
        {
            return BusinessLogic.PhieuThu.Select();
        }

        public Entities.PhieuThu[] SelectPhieuThuTheoDiaDiem(string madiadiem)
        {
            return BusinessLogic.PhieuThu.SelectTheoDiaDiem(madiadiem);
        }

        public bool InsertUpdatePhieuThu(Entities.PhieuThu phieuthu)
        {
            return BusinessLogic.PhieuThu.InsertUpdate(phieuthu);
        }

        public bool DeletePhieuThu(Entities.PhieuThu phieuthu)
        {
            return BusinessLogic.PhieuThu.Delete(phieuthu);
        }

        #endregion

        #region TK Kế Toán
        public Entities.TKKeToan[] SelectCoNo(string hanhdong)
        {
            return BusinessLogic.PhieuThu.SelectCoNo(hanhdong);
        }

        public Entities.TKKeToan[] SelectTKKeToan(Entities.TKKeToan giatri)
        {
            return BusinessLogic.TKKeToan.Select(giatri);
        }

        public int InsertUpdateTKKeToan(Entities.TKKeToan giatri)
        {
            return BusinessLogic.TKKeToan.InsertUpdate(giatri);
        }

        public int DeleteTKKeToan(Entities.TKKeToan giatri)
        {
            return BusinessLogic.TKKeToan.Delete(giatri);
        }
        #endregion

        #region Phiếu Thanh Toán Của Khách Hàng
        public Entities.PhieuTTCuaKH[] SelectPhieuTTKH()
        {
            return BusinessLogic.PhieuTTKH.Select();
        }

        public Entities.PhieuTTCuaKH[] SelectPhieuTTKHTheoDiaDiem(string makho)
        {
            return BusinessLogic.PhieuTTKH.SelectTheoDiaDiem(makho);
        }

        public bool InsertUpdatePhieuTTKH(Entities.PhieuTTCuaKH phieuthanhtoankhackhang)
        {
            return BusinessLogic.PhieuTTKH.InsertUpdate(phieuthanhtoankhackhang);
        }

        public bool DeletePhieuTTKH(Entities.PhieuTTCuaKH phieuthanhtoankhackhang)
        {
            return BusinessLogic.PhieuTTKH.Delete(phieuthanhtoankhackhang);
        }

        public Entities.ChiTietPhieuTTCuaKH[] SelectChiTietPhieuTTKH(string maphieuTTKH)
        {
            return BusinessLogic.ChiTietPhieuTTKH.Select(maphieuTTKH);
        }

        public Entities.ChiTietPhieuTTCuaKH[] SelectChiTietPhieuTTKH1()
        {
            return BusinessLogic.ChiTietPhieuTTKH.Select();
        }

        public bool InsertUpdateChiTietPhieuTTCuaKH(Entities.ChiTietPhieuTTCuaKH[] chitietphieuttkh)
        {
            return BusinessLogic.ChiTietPhieuTTKH.InsertUpdate(chitietphieuttkh);
        }

        public bool UpdateTTHDBB(string mahdbanbuon, string phieuttsau)
        {
            return BusinessLogic.PhieuTTKH.InsertUpdate(mahdbanbuon, phieuttsau);
        }

        public bool UpdateKHTraLai(string mahd, string phieuttsau, string loai)
        {
            return BusinessLogic.PhieuTTKH.InsertUpdate(mahd, phieuttsau, loai);
        }

        public bool UpdateDuNoKH(string makh, string duno)
        {
            return BusinessLogic.PhieuTTKH.InsertUpdateDuNoKH(makh, duno);
        }

        public Entities.KhachHangTraLaiBanBuon[] SelectHDKHTraLaiBanBuonTheoMaKH(string makh)
        {
            return BusinessLogic.PhieuTTKH.SelectHDKHTraLaiBanBuonTheoMaKH(makh);
        }


        #endregion

        #region Phiếu Thanh Toán Của Nhà Cung Cấp
        public Entities.PhieuTTNCC[] SelectPhieuTTNCC()
        {
            return BusinessLogic.PhieuTTNCC.Select();
        }

        public Entities.PhieuTTNCC[] SelectPhieuTTNCCTheoDiaDiem(string madiadiem)
        {
            return BusinessLogic.PhieuTTNCC.SelectTheoDiaDiem(madiadiem);
        }

        public bool InsertUpdatePhieuTTNCC(Entities.PhieuTTNCC phieuthanhtoannhacungcap)
        {
            return BusinessLogic.PhieuTTNCC.InsertUpdate(phieuthanhtoannhacungcap);
        }

        public bool DeletePhieuTTNCC(Entities.PhieuTTNCC phieuthanhtoannhacungcap)
        {
            return BusinessLogic.PhieuTTNCC.Delete(phieuthanhtoannhacungcap);
        }

        public Entities.ChiTietPhieuTTNCC[] SelectChiTietPhieuTTNCC(string maphieuTTNCC)
        {
            return BusinessLogic.ChiTietPhieuTTNCC.Select(maphieuTTNCC);
        }

        public Entities.ChiTietPhieuTTNCC[] SelectChiTietPhieuTTNCC1()
        {
            return BusinessLogic.ChiTietPhieuTTNCC.Select();
        }

        public bool InsertUpdateChiTietPhieuTTNCC(Entities.ChiTietPhieuTTNCC[] chitietphieuttncc)
        {
            return BusinessLogic.ChiTietPhieuTTNCC.InsertUpdate(chitietphieuttncc);
        }

        public bool UpdateHDNhap(string mahdnhap, string phieuttsau)
        {
            return BusinessLogic.PhieuTTNCC.InsertUpdate(mahdnhap, phieuttsau);
        }

        public bool UpdateTraLaiNCC(string mahdnhap, string phieuttsau, string loai)
        {
            return BusinessLogic.PhieuTTNCC.InsertUpdateTraLaiNCC(mahdnhap, phieuttsau, loai);
        }

        public bool UpdateDuNoNCC(string mancc, string duno)
        {
            return BusinessLogic.PhieuTTNCC.InsertUpdateDuNoNCC(mancc, duno);
        }

        public Entities.HoaDonNhap[] SelectHDNhapTheoMaNCC(string mancc)
        {
            return BusinessLogic.PhieuTTKH.SelectTheoMaNCC(mancc);
        }

        public Entities.TraLaiNCC[] SelectHDTraLaiNCCTheoMaNCC(string mancc)
        {
            return BusinessLogic.TraLaiNCC.SelectHDTraLaiNCCTheoMaNCC(mancc);
        }

        public Entities.HoaDonNhap[] SelectHDNhapTheoMaHDNhap(string maHDNhap)
        {
            return BusinessLogic.PhieuTTNCC.SelectHDNhapTheoMaHDNhap(maHDNhap);
        }


        #endregion

        public Entities.GiaTriCombox[] SelectTKKT(Entities.GiaTriCombox combox)
        {
            return BusinessLogic.LayLoaiTKKT.sp_Select_TKKT(combox);
        }

        public Entities.GetCombobox[] SelectComboxCacBang(Entities.GetCombobox combox)
        {
            return BusinessLogic.GetCombobox.SelectCombox(combox);
        }

        // insert update

        public int InsertUpdateChiTietCongNoKH(Entities.ChiTietCongNoKH khachhang)
        {
            return BusinessLogic.ChiTietCongNoKH.InsertUpdate(khachhang);
        }

        public int InsertUpdateChiTietCongNoNCC(Entities.ChiTietCongNoNCC khachhang)
        {
            return BusinessLogic.ChiTietCongNoNCC.InsertUpdate(khachhang);
        }

        public Entities.ChiTietCongNoKH[] SelectChiTietCongNoKH(Entities.ChiTietCongNoKH chitiet)
        {
            return BusinessLogic.ChiTietCongNoKH.Select(chitiet);
        }

        public Entities.ChiTietCongNoNCC[] SelectChiTietCongNoNCC(Entities.ChiTietCongNoNCC chitiet)
        {
            return BusinessLogic.ChiTietCongNoNCC.Select(chitiet);
        }

        public Entities.TimKiemNhanVien[] SelecttimKiemNhanVien()
        {
            return BusinessLogic.TimKiemNhanVien.Select();
        }

        public Entities.NhaCungCap[] SelectNCC()
        {
            return BusinessLogic.PhieuChi.SelectNCC();
        }

        public Entities.KhachHang[] SelectKH1()
        {
            return BusinessLogic.KhachHang.Select();
        }

        public Entities.NhaCungCap[] Select_NCC()
        {
            return BusinessLogic.NhaCungCap.Select();
        }


        #endregion








        
    }
}
#endregion
